import cv2
import numpy as np

cap=cv2.VideoCapture(0)
while True:
    ret,frame=cap.read()
    img=cv2.flip(frame,1)
    cv2.imshow("hello",img)
    key=cv2.waitKey(100)
    if key==ord('q') or key==27:  #27 is ESC key
        break
cv2.destroyAllWindows()
cap.release()

